<script setup>
import { ref } from "vue";
import { Mousewheel,Navigation, Pagination, Scrollbar, A11y } from 'swiper/modules';
import { Swiper, SwiperSlide } from "swiper/vue";
import myWebList from "../json/myWebList.json";
import "swiper/css";
let modules = ref([Mousewheel,Navigation,Pagination])
let mySiteList = ref([...myWebList.sites]);
console.log(mySiteList, "我的网站地址");

const onSwiper = (swiper) => {
  console.log(swiper);
};
const onSlideChange = () => {
  console.log("slide change");
};
function toClickItemSite(data){
    window.open(data.target)
}
</script>

<template>
  <div class="my-site-list-wrapper">
    <!-- <div class="my-site-list-cont glass-effect-0"> -->
      <div class="my-site-list-cont">
      <swiper
        :space-between="50"
        :modules="modules"
         :mousewheel="{ mousewheel: true }"
         :pagination="{ clickable: true }"
        @swiper="onSwiper"
        @slideChange="onSlideChange"
        class="swiper"
      >
        <swiper-slide v-for="(item, index) in mySiteList" :key="index"
          ><ul >
            <li v-for="item2 in item" :key="item2.uuid" @click="toClickItemSite(item2)">
              <div :style="`background-image:url(${item2.bgImage})`" alt="" ></div><span class="ellipsis-s">{{ item2.name }}</span>
            </li>
          </ul></swiper-slide
        >
      </swiper>
    </div>
  </div>
</template>
<style></style>
<style lang="scss" scoped>
.my-site-list-wrapper {
  width: 1200px;
  margin: 40px auto 0;
  .my-site-list-cont {
    width: 100%;
    height: 100%;
    color: #fff;

    .swiper,
    .swiper-slide {
      height: 100%;
    }
    .swiper-slide {
      ul {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
        li {
          overflow: hidden;
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          padding: 15px;
          div {
            width: 40px;
            height: 40px;
            border-radius: 2%;
            background-size: 100% 100%;
            background-color: #fff;
            margin-bottom: 15px;
          }
          span {
            width: 90%;
            text-align: center;
            font-size: 14px;
          }
        }
      }
    }
  }
}
</style>
